%%-*-erlang-*-
{require_min_otp_vsn, "21"}.

{erl_opts, [
    debug_info,
    %% used by erlmongo
    tuple_calls,
    {parse_transform, lager_transform}
]}.

{dialyzer, [
    %% {warnings, [error_handling, unknown, unmatched_returns]},
    {warnings, [error_handling, unknown]},
    {get_warnings, true}
]}.

{deps, [
    {lager, "3.7.0"},
    {eid, {git, "https://github.com/jur0/eid.git", {tag, "0.6.0"}}},
    {cowlib, {git, "https://github.com/ninenines/cowlib", {tag, "2.6.0"}}},
    {cowboy, {git, "https://github.com/ninenines/cowboy", {tag, "2.5.0"}}},
    {gun, {git, "https://github.com/ninenines/gun.git", {tag, "1.3.0"}}},
    {jsx, "2.10.0"},
    {iso8601, "1.3.1"},
    {cbor, {git, "https://github.com/yjh0502/cbor-erlang.git", {ref, "b5c9dbc2de15753b2db15e13d88c11738c2ac292"}}},
    {gen_smtp, "0.15.0"},
    {amqp_client, "3.7.18"},
    {emqtt, {git, "https://github.com/emqx/emqtt.git", {tag, "v1.1.1"}}},
    {erlmongo, {git, "https://github.com/SergejJurecko/erlmongo.git", {ref, "f0d03cd4592f7bf28059b81214b61c28ccf046c0"}}},
    {prometheus_cowboy, "0.1.8"}
]}.

{post_hooks, [
    {compile, "npm install --save"},
    {compile, "cp node_modules/jquery/dist/jquery.min.js priv/admin"},
    {compile, "cp node_modules/ng-admin/build/ng-admin.min.js priv/admin"},
    {compile, "cp node_modules/ng-admin/build/ng-admin.min.css priv/admin"},
    {compile, "cp node_modules/angular-simple-logger/dist/angular-simple-logger.min.js priv/admin"},
    {compile, "cp node_modules/angular-google-chart/ng-google-chart.min.js priv/admin"},
    {compile, "cp node_modules/leaflet/dist/leaflet.js priv/admin"},
    {compile, "cp node_modules/leaflet/dist/leaflet.css priv/admin"},
    {compile, "cp node_modules/ui-leaflet/dist/ui-leaflet.min.js priv/admin"},
    {compile, "cp node_modules/vis/dist/vis.min.js priv/admin"},
    {compile, "cp node_modules/vis/dist/vis.min.css priv/admin"},
    {compile, "cp -r node_modules/vis/dist/img priv/admin"},
    {compile, "cp node_modules/angular-visjs/angular-vis.js priv/admin"},
    {compile, "cp node_modules/angular-bootstrap-colorpicker/js/bootstrap-colorpicker-module.min.js priv/admin"},
    {compile, "cp node_modules/angular-bootstrap-colorpicker/css/colorpicker.min.css priv/admin"},
    {compile, "sh -c \"for f in priv/admin/*.js priv/admin/*.css; do gzip -c \\$f > \\$f.gz; done\""}
]}.

{artifacts, [
    "priv/admin/jquery.min.js",
    "priv/admin/ng-admin.min.js",
    "priv/admin/ng-admin.min.css",
    "priv/admin/angular-simple-logger.min.js",
    "priv/admin/ng-google-chart.min.js",
    "priv/admin/leaflet.js",
    "priv/admin/leaflet.css",
    "priv/admin/ui-leaflet.min.js",
    "priv/admin/vis.min.js",
    "priv/admin/vis.min.css",
    "priv/admin/angular-vis.js",
    "priv/admin/bootstrap-colorpicker-module.min.js",
    "priv/admin/colorpicker.min.css"
]}.

{relx, [
    {release, {'lorawan-server', "0.7.0"},
        [lorawan_server]},
    {sys_config, "lorawan_server.config"},
    {dev_mode, false},
    {include_src, false},
    {include_erts, false},
    {system_libs, false},
    {generate_start_script, false},
    {overlay, [
        {copy, "scripts/dbexport", "bin/dbexport"},
        {copy, "scripts/dbexport.bat", "bin/dbexport.bat"},
        {copy, "scripts/dbimport", "bin/dbimport"},
        {copy, "scripts/dbimport.bat", "bin/dbimport.bat"},
        {template, "scripts/lorawan-server", "bin/lorawan-server"},
        {copy, "scripts/lorawanctl", "bin/lorawanctl"},
        {template, "scripts/lorawan-server.bat", "bin/lorawan-server.bat"},
        {template, "scripts/lorawan-service.bat", "bin/lorawan-service.bat"},
        {copy, "scripts/lorawan-server.service", "bin/lorawan-server.service"}
    ]}
]}.
